package com.erp.activity

import android.app.Activity
import android.content.Intent
import android.view.View
import android.view.WindowManager
import com.erp.mclass.UnCeHandler
import com.erp.R
import com.erp.view.AddressPickerView
import kotlinx.android.synthetic.main.activity_dizhi_dialog.*



/**
 * Created by Administrator on 2018/5/28/028.
 * 作者：刘洋
 */
class DiZhiDKActivity : BasedialogActivity(), AddressPickerView.OnAddressPickerSureListener, View.OnClickListener {


    val f = "DiZhiDKActivity"

    override fun getLayoutId(): Int {
        UnCeHandler.fragment=f
        return R.layout.activity_dizhi_dialog
    }

    override fun initCreate() {
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
        //        透明导航栏
        window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
        VF.setOnClickListener(this)
//        apvAddress.setOnAddressPickerSure(this)
    }
    override fun onSureClick(address: String?, provinceCode: String?, cityCode: String?, districtCode: String?) {
        val intent = Intent()
        if(address!=null) {
            intent.putExtra("address", address)
        }else{
            intent.putExtra("address", "")
        }
        if(provinceCode!=null){
            intent.putExtra("provinceCode",provinceCode)
        }else{
            intent.putExtra("provinceCode","")
        }
        if(cityCode!=null){
            intent.putExtra("cityCode",cityCode)
        }else{
            intent.putExtra("cityCode","")
        }
        if(districtCode!=null){
            intent.putExtra("districtCode",districtCode)
        }else{
            intent.putExtra("districtCode","")
        }
        setResult(Activity.RESULT_OK,intent)
    }
    override fun onClick(v: View?) {
        when(v){
            VF -> {
                finish()
            }
        }
    }
}